<?php
	function takeStocks($name,$page) {
		$factory = Factories::Init();
		$db      = $factory->databaseObject("select", "stocks");
		$array   = $db->extractAllFromCategory($name,$page);
		
		if (session_status() == PHP_SESSION_NONE) {
			session_start();
		}
		$_SESSION['Numbers'] = count($array);


		$objects = array();
		foreach ($array as $val) {
			$obj = $factory->controlerObject("Stock");
			$obj->Init($val);
			array_push($objects, $obj);
		}

		return $objects;
	}
/*	function getStocksNumber(){
		if (session_status() == PHP_SESSION_NONE) {
			session_start();
		}
		return $_SESSION['Numbers'];
	}*/
	function getPagesNumber($all_stocks){
		if ($all_stocks / 10 == 0)
			return $all_stocks /10;
		else
			return ((int) ($all_stocks/10)) + 1;

	}
?>